import { getLandaucPartyDetailApi } from "../../api/shesu";
Page({
  /**
   * 页面的初始数据
   */
  data: {
    // rightLine 右侧装饰线
    // bottomLine 底部装饰线
    // col 占位列数
    // style 值样式
    contentList: [
      {
        name: "土地拍卖使用权人",
        list: [
          {
            key: "companyName",
            label: "企业名称",
            value: "",
            col: 2,
            bottomLine: true,
          },
          {
            key: "dates",
            label: "变更时间",
            value: "",
            rightLine: true,
          },
          {
            key: "updatedDate",
            label: "更新时间",
            value: "",
          },
        ],
      },
      {
        name: "土地拍卖结果",
        list: [
          {
            key: "projectLocation",
            label: "项目位置",
            value: "",
            col: 2,
            bottomLine: true,
          },
          {
            key: "projectName",
            label: "项目名称",
            value: "",
            col: 2,
            bottomLine: true,
          },

          {
            key: "regArea",
            label: "行政区",
            value: "",
            rightLine: true,
            bottomLine: true,
          },
          {
            key: "elecSuperNumber",
            label: "电子监管号",
            value: "",
            bottomLine: true,
          },
          {
            key: "landArea",
            label: "土地总面积(公顷)",
            value: "",
            rightLine: true,
            bottomLine: true,
            style: "color:#F04040",
          },
          {
            key: "landSupplyType",
            label: "供地方式",
            value: "",
            bottomLine: true,
          },

          {
            key: "landUseTerm",
            label: "土地使用年限",
            value: "",
            rightLine: true,
            bottomLine: true,
          },
          {
            key: "industry",
            label: "行业分类",
            value: "",
            bottomLine: true,
          },

          {
            key: "landGrade",
            label: "土地等级",
            value: "",
            rightLine: true,
            bottomLine: true,
          },
          {
            key: "turnoverPrice",
            label: "成交价格(万元)",
            value: "",
            bottomLine: true,
          },
          {
            key: "approvalOrg",
            label: "批准单位",
            value: "",
            col: 2,
            bottomLine: true,
          },
          {
            key: "landUser",
            label: "土地使用权人",
            value: "",
            col: 2,
            bottomLine: true,
          },

          {
            key: "agreeDeliveryDate",
            label: "约定交地时间",
            value: "",
            rightLine: true,
            bottomLine: true,
          },
          {
            key: "agreeStartDate",
            label: "约定开工时间",
            value: "",
            bottomLine: true,
          },
          {
            key: "agreeCompletionDate",
            label: "约定竣工时间",
            value: "",
            rightLine: true,
            bottomLine: true,
          },
          {
            key: "actualCompletionDate",
            label: "实际竣工时间",
            value: "",
            bottomLine: true,
          },
          {
            key: "signDate",
            label: "合同签订时间",
            value: "",
            rightLine: true,
            bottomLine: true,
          },
          {
            key: "dates",
            label: "变更时间",
            value: "",
            bottomLine: true,
          },
          {
            key: "updateDate",
            label: "更新时间",
            value: "",
            bottomLine: true,
          },
        ],
      },
      {
        name: "约定容积率",
        list: [
          {
            key: "maxFloorAreaRatio",
            label: "容积率上限",
            value: "",
            rightLine: true,
          },
          {
            key: "minFloorAreaRatio",
            label: "容积率下限",
            value: "",
          },
        ],
      },
      {
        name: "分期支付约定",
        list: [],
        // { label: "支付期号", prop: "payingPeriod" },
        // { label: "约定支付时间", prop: "payingDate", type: "date" },
        // { label: "约定支付金额（万元）", prop: "payingAmount", type: "amount" },
        // { label: "支付备注", prop: "remark" },
        // { label: "变更时间", prop: "dates" },
        // { label: "更新时间", prop: "updatedDate" }
      },
    ],
    id: "",
    info: "",
  },
  getDetail() {
    getLandaucPartyDetailApi({ id: this.data.id }).then((res: any) => {
      if (res.code === "000") {
        let landaucParty = res.content.landaucParty;
        let landaucResult = res.content.landaucResult;
        let agreedVolume = res.content.agreedVolume;
        let landaucPay = res.content.landaucPay;
        this.data.contentList[0].list.forEach((item: any) => {
          item.value = landaucParty[item.key];
        });
        this.data.contentList[1].list.forEach((item: any) => {
          item.value = landaucResult[item.key];
        });
        this.data.contentList[2].list.forEach((item: any) => {
          item.value = agreedVolume[item.key];
        });
        this.data.contentList[3].list = landaucPay;
        this.setData({
          contentList: this.data.contentList,
        });
      }
    });
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(option: any) {
    this.setData({
      info: JSON.parse(option.info),
      id: JSON.parse(option.info).id,
    });
    this.getDetail();
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {},
});
